package ezCall;

import net.rim.device.api.ui.component.CheckboxField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.ObjectChoiceField;
import net.rim.device.api.ui.component.SeparatorField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;


public class Option_Screen extends MainScreen
{
	
	HorizontalFieldManager _MainScreen_ClickHorManager;
	HorizontalFieldManager _MainScreen_EnterHorManager;
	
	ObjectChoiceField  _MainScr_Click;
	ObjectChoiceField  _MainScr_Enter;
	ObjectChoiceField  _PhoneScr_Click;
	ObjectChoiceField  _PhoneScr_Enter;
	
	ObjectChoiceField  _Find_SubMode;
	ObjectChoiceField  _Order_NameView;
	ObjectChoiceField  _AutoStart;
	ObjectChoiceField  _DefaultInputMode;
		
	
	CheckboxField  _ClearText_AfterCall;
	CheckboxField  _Photo_View;
	CheckboxField  _Space_BetweenLastFirstName;
	CheckboxField  _Support_9100;
	
	
	
	Option_Model           _Option_Model;
	
	boolean Updated;
	
	
    public Option_Screen( Option_Model _Option_Model_Arg )
    {	
    	int SelectedIndex;
    	
    	_Option_Model = _Option_Model_Arg;
    	
    	
    	_MainScreen_ClickHorManager = new HorizontalFieldManager();
    	_MainScreen_EnterHorManager = new HorizontalFieldManager();
    	
    	this.setTitle("ezCall-Option");
    	
    	Updated = false;
    	
    	
    	add( new LabelField("Main Screen"));

    	SelectedIndex =  _Option_Model.Get_SelectedStrIndex(Option_Model.MAIN_SCREEN_CLICK_FUNC );
    	
    	_MainScr_Click = new ObjectChoiceField("  Click :", _Option_Model.Get_FuncStr( Option_Model.MAIN_SCREEN_CLICK_FUNC), SelectedIndex );
    	add( _MainScr_Click );
    	
    	SelectedIndex =  _Option_Model.Get_SelectedStrIndex(Option_Model.MAIN_SCREEN_ENTER_FUNC );
    	_MainScr_Enter = new ObjectChoiceField("  Enter :", _Option_Model.Get_FuncStr( Option_Model.MAIN_SCREEN_ENTER_FUNC), SelectedIndex );
    	add( _MainScr_Enter );

    	//--
    	add( new SeparatorField());
    	
    	
    	add( new LabelField("PopupList Screen"));    	
    	SelectedIndex =  _Option_Model.Get_SelectedStrIndex(Option_Model.PHONE_SCREEN_CLICK_FUNC );
    	
    	_PhoneScr_Click = new ObjectChoiceField("  Click :", _Option_Model.Get_FuncStr( Option_Model.PHONE_SCREEN_CLICK_FUNC), SelectedIndex );
    	add( _PhoneScr_Click );

    	SelectedIndex =  _Option_Model.Get_SelectedStrIndex(Option_Model.PHONE_SCREEN_ENTER_FUNC );
    	
    	_PhoneScr_Enter = new ObjectChoiceField("  Enter :", _Option_Model.Get_FuncStr( Option_Model.PHONE_SCREEN_ENTER_FUNC), SelectedIndex );
    	add( _PhoneScr_Enter ); 	

    	
    	
    	//--
    	add( new SeparatorField());

    	String FindSubMode_Str[] = {"Name&Company", "Name First", "Company First" };
    	_Find_SubMode = new ObjectChoiceField("Default Find :", FindSubMode_Str , _Option_Model.Get_Find_SubMode() );
    	add( _Find_SubMode ); 	
    	    	
    	String OrderNameView_Str[] = {"Last-First", "First-Last"};
    	_Order_NameView = new ObjectChoiceField("Name view order :", OrderNameView_Str , _Option_Model.Get_Order_NameView() );
    	add( _Order_NameView ); 	
    	
    	
    	
    	String AutoStart_Str[] = {"No", "Yes"};
    	_AutoStart = new ObjectChoiceField("Autostart on boot :", AutoStart_Str , _Option_Model.Get_AutoStart() );
    	add( _AutoStart ); 
    	
    	String DefaultInputMode_Str[] = {"Korean", "English", "None"};
    	_DefaultInputMode = new ObjectChoiceField("Default Input Mode :", DefaultInputMode_Str , _Option_Model.Get_DefaultInputMode() );
    	add( _DefaultInputMode ); 
    	
    	
    	
    	
    	add( new SeparatorField());
    	
    	_ClearText_AfterCall = new CheckboxField("Clear text After Call", _Option_Model.Get_ClearText_AfterCall() );
    	add( _ClearText_AfterCall );
    	
    	_Photo_View = new CheckboxField("Photo View", _Option_Model.Get_Photo_View() );
    	add( _Photo_View );
    	
    	_Space_BetweenLastFirstName = new CheckboxField("Space between last-first name", _Option_Model.Get_Space_BetweenLastFirstName() );
    	add( _Space_BetweenLastFirstName );
    	
    	
    	add( new SeparatorField());
    	
    	_Support_9100 = new CheckboxField("Support 9100", _Option_Model.Get_Support9100() );
    	add( _Support_9100 );
    	
    	
    	add( new SeparatorField());
    	
    	add( new LabelField("특허내용"));
    	add( new LabelField("발명의 명칭 : 한글두음문자열검색방법및장치"));
    	add( new LabelField("등록번호    : 10-0285119"));
    	add( new LabelField("특허권자    : 조 관 현"));
    	
    }
    
    
    public boolean Get_Updated()
    {
    	return Updated;
    }
    
    
    protected boolean onSave()
    {
    	Updated = true;
        	
    	_Option_Model.Set_Field( Option_Model.MAIN_SCREEN_CLICK_FUNC, _MainScr_Click.toString() );
    	_Option_Model.Set_Field( Option_Model.MAIN_SCREEN_ENTER_FUNC, _MainScr_Enter.toString() );
    	_Option_Model.Set_Field( Option_Model.PHONE_SCREEN_CLICK_FUNC, _PhoneScr_Click.toString() );
    	_Option_Model.Set_Field( Option_Model.PHONE_SCREEN_ENTER_FUNC, _PhoneScr_Enter.toString() );
    	
    	_Option_Model.Set_ClearText_AfterCall( _ClearText_AfterCall.getChecked() );
    	_Option_Model.Set_Photo_View( _Photo_View.getChecked() );
    	_Option_Model.Set_Space_BetweenLastFirstName( _Space_BetweenLastFirstName.getChecked() );
      	_Option_Model.Set_Support9100(_Support_9100.getChecked() );
          	
    	
    	
    	_Option_Model.Set_Find_SubMode( _Find_SubMode.getSelectedIndex() );
    	_Option_Model.Set_Order_NameView( _Order_NameView.getSelectedIndex());
    	_Option_Model.Set_AutoStart( _AutoStart.getSelectedIndex() );
    	_Option_Model.Set_DefaultInputMode( _DefaultInputMode.getSelectedIndex() );
    	
    	
    	return super.onSave();
    }
    
    
}
